﻿@model Project.Models.AdvertModel
@{
    ViewBag.Title = "Add an Advert";
}
<h2>
    Add an Advert</h2>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@using (Html.BeginForm("AddAdvert", "Advert", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    @Html.ValidationSummary(true)
    <fieldset>
        @Html.HiddenFor(model => model.CampaignID, new { Value = ViewBag.cid })
        <legend>Add an advert</legend>
        <div class="editor-label">
            @Html.LabelFor(model => model.Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.AdTypeID)
        </div>
        <div>
            @Html.DropDownListFor(model => model.AdTypeID, new SelectList(ViewBag.AdTypes as System.Collections.IEnumerable, "Value", "Text"), "Select")
            @Html.ValidationMessageFor(model => model.AdTypeID)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.CategoryID)
        </div>
        <div>
            @Html.DropDownListFor(model => model.CategoryID, new SelectList(ViewBag.Categories as System.Collections.IEnumerable, "Value", "Text"), "Select")
            @Html.ValidationMessageFor(model => model.CategoryID)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.TargetURL)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.TargetURL)
            @Html.ValidationMessageFor(model => model.TargetURL)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.CountryID)
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.CountryID, new SelectList(ViewBag.Countries as System.Collections.IEnumerable, "Value", "Text"), "Select")
            @Html.ValidationMessageFor(model => model.CountryID)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.Keywords)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Keywords)
            @Html.ValidationMessageFor(model => model.Keywords)
        </div>
        <div class="editor-label">
            Advert file
        </div>
        <div>
            <input type="file" name="file" id="file" />
        </div>
        <div>
            <input type="submit" value="Add" /></div>
    </fieldset>
}
<div>
    @Html.ActionLink("Back to profile", "Profile", "Home")
</div>
